#include<iostream>
#include<cmath>
const int N = 200;
int a[N];
using namespace std;
int main()
{
	int n;cin >> n;
	for (int i = 1; i <= 4; i++)
	{
		n = n >> 1;
	}
	int sum = 0;int count = 0;
	for (int i = 1; i <= 4; i++)
	{
		a[i] = n % 2;
		n /= 2;	
		count++;
	}
	while (a[count] == 0) count--;
	for (int i = 1; i <= count; i++)
	{
		sum += a[i] * pow(2, i - 1);
	}
	cout << sum << endl;
	return 0;
}